<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3//EN">
<HTML><HEAD>
		<TITLE>User's Reference - Format</TITLE>
		<META HTTP-EQUIV="keywords" CONTENT="GRAPHICS VISUALIZATION VISUAL PROGRAM DATA
MINING">
	<meta http-equiv="content-type" content="text/html;charset=ISO-8859-1">
</HEAD><BODY BGCOLOR="#FFFFFF" link="#00004b" vlink="#4b004b">
		<TABLE width=510 border=0 cellpadding=0 cellspacing=0>
			<TR>
				<TD><IMG src="../images/spacer.gif" width=80 height=1></TD>
				<TD><IMG src="../images/spacer.gif" width=49 height=1></TD>
				<TD><IMG src="../images/spacer.gif" width=24 height=1></TD>
				<TD><IMG src="../images/spacer.gif" width=100 height=1></TD>
				<TD><IMG src="../images/spacer.gif" width=3 height=1></TD>
				<TD><IMG src="../images/spacer.gif" width=127 height=1></TD>
				<TD><IMG src="../images/spacer.gif" width=6 height=1></TD>
				<TD><IMG src="../images/spacer.gif" width=50 height=1></TD>
				<TD><IMG src="../images/spacer.gif" width=71 height=1></TD>
			</TR>
			<TR>
				<TD colspan=9><IMG src="../images/flcgh_01.gif" width=510 height=24 alt="OpenDX - Documentation"></TD>
			</TR>
			<TR>
				<TD colspan=2><A href="../allguide.htm"><IMG src="../images/flcgh_02.gif" width=129 height=25 border="0" alt="Full Contents"></A></TD>
				<TD colspan=3><A href="../qikguide.htm"><IMG src="../images/flcgh_03.gif" width=127 height=25 border="0" alt="QuickStart Guide"></A></TD>
				<TD><A href="../usrguide.htm"><IMG src="../images/flcgh_04.gif" width=127 height=25 border="0" alt="User's Guide"></A></TD>
				<TD colspan=3><B><A href="../refguide.htm"><IMG src="../images/flcgh_05d.gif" width=127 height=25 border="0" alt="User's Reference"></A></B></TD>
			</TR>
			<TR>
				<TD><A href="refgu064.htm"><IMG src="../images/flcgh_06.gif" width=80 height=17 border="0" alt="Previous Page"></A></TD>
				<TD colspan=2><A href="refgu066.htm"><IMG src="../images/flcgh_07.gif" width=73 height=17 border="0" alt="Next Page"></A></TD>
				<TD><A href="../refguide.htm"><IMG src="../images/flcgh_08.gif" width=100 height=17 border="0" alt="Table of Contents"></A></TD>
				<TD colspan=3><A href="refgu009.htm"><IMG src="../images/flcgh_09.gif" width=136 height=17 border="0" alt="Partial Table of Contents"></A></TD>
				<TD><A href="refgu175.htm"><IMG src="../images/flcgh_10.gif" width=50 height=17 border="0" alt="Index"></A></TD>
				<TD><A href="../srchindx.htm"><IMG src="../images/flcgh_11.gif" width=71 height=17 border="0" alt="Search"></A></TD>
			</TR>
		</TABLE>
		<H3><A name="HDRFORMAT" ></A>Format</H3>
		<A NAME="IDX519"></A><A NAME="IDX520"></A>
<P><STRONG>Category</STRONG>
<P>
<A HREF="refgu008.htm#HDRCATANN">Annotation</A>
<P><STRONG>Function</STRONG>
<P>
Formats a string.
<P><STRONG>Syntax</STRONG>
<PRE>
<STRONG>string</STRONG> = Format(<STRONG>template, value, ...</STRONG>);
</PRE>
<P><STRONG>Inputs</STRONG>
<BR>
<TABLE BORDER>
<TR>
<TH ALIGN="LEFT" VALIGN="TOP" WIDTH="20%">Name
</TH><TH ALIGN="LEFT" VALIGN="TOP" WIDTH="20%">Type
</TH><TH ALIGN="LEFT" VALIGN="TOP" WIDTH="20%">Default
</TH><TH ALIGN="LEFT" VALIGN="TOP" WIDTH="40%">Description
</TH></TR><TR>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="20%"><TT><STRONG>template</STRONG></TT>
</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="20%">string
</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="20%">none
</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="40%">format control string
</TD></TR><TR>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="20%"><TT><STRONG>value</STRONG></TT>
</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="20%">value list or string
</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="20%">no default
</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="40%">value to format
</TD></TR><TR>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="20%"><TT><STRONG>...</STRONG></TT>
</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="20%">&nbsp;
</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="20%">&nbsp;
</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="40%">more values to format
</TD></TR></TABLE>
<P><STRONG>Outputs</STRONG>
<BR>
<TABLE BORDER>
<TR>
<TH ALIGN="LEFT" VALIGN="TOP" WIDTH="25%">Name
</TH><TH ALIGN="LEFT" VALIGN="TOP" WIDTH="25%">Type
</TH><TH ALIGN="LEFT" VALIGN="TOP" WIDTH="50%">Description
</TH></TR><TR>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="25%"><TT><STRONG>string</STRONG></TT>
</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="25%">string
</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="50%">formatted string object
</TD></TR></TABLE>
<P><STRONG>Functional Details</STRONG>
<P>
This module uses a format-control string and input values to create a
formatted output string.
Each insertion is matched to a format-control specification, which
always begins with a <TT>%</TT> symbol.
Strings, scalars, integers, and vectors can be formed into output
strings.
<TABLE CELLPADDING="3">
<TR VALIGN="TOP"><TD><P><B><TT><STRONG>template</STRONG></TT>
</B></TD><TD><P>is the format-control string used in creating the formatted
output.
It resembles a C-language <TT>printf</TT> format string.
<P>
Data Explorer copies all characters other than format specifications to the
output (see next parameter).
</TD></TR><TR VALIGN="TOP"><TD><P><B><TT><STRONG>value</STRONG></TT>
</B></TD><TD><P>is the value to be placed in the output string.
The character following the <TT>%</TT> controls the type of
conversion:
<TABLE CELLPADDING="3">
<TR VALIGN="TOP"><TD><P><B><TT><STRONG>c</STRONG></TT>
</B></TD><TD><P>single characters
</TD></TR><TR VALIGN="TOP"><TD><P><B><TT><STRONG>d</STRONG></TT>
</B></TD><TD><P>integers
</TD></TR><TR VALIGN="TOP"><TD><P><B><TT><STRONG>f</STRONG></TT>
</B></TD><TD><P>floating point (fixed number of digits following the decimal
point)
</TD></TR><TR VALIGN="TOP"><TD><P><B><TT><STRONG>g</STRONG></TT>
</B></TD><TD><P>general (scientific notation if appropriate)
</TD></TR><TR VALIGN="TOP"><TD><P><B><TT><STRONG>s</STRONG></TT>
</B></TD><TD><P>strings.
<P><B>Note: </B><TT><STRONG>f</STRONG></TT> and <TT><STRONG>g</STRONG></TT> will
also format
2- and 3-vectors and lists.
</TD></TR></TABLE>
<P>
To output a <TT>%</TT>, use <TT>%%</TT>.
You can insert numbers between the <TT>%</TT> and the conversion
character to control the width of the field and the number of
significant digits formatted.
A minus sign (&#45;) left-justifies the output in the field;
the default is right-justification.
A format control string of
<PRE>
"%-10.4f"
</PRE>
indicates left
justification of a floating-point number, minimum of 10
columns total, with 4 places to the right of the
decimal point.
</TD></TR></TABLE>
<P>
A single call to the Format module can format a maximum of
21 values.
In the user interface, the default number of enabled
<TT><STRONG>value</STRONG></TT>
tabs is two.
(Tabs can be added to the module icon and removed with the appropriate
<TT><STRONG>...Input Tab</STRONG></TT> options in the
<TT><STRONG>Edit</STRONG></TT> pull-down menu of
the VPE.)
<P><STRONG>Script Language Examples</STRONG>
<OL>
<P><LI>In this example, <I>value1</I> is set to 32.567799
<PRE>
value1 = 32.567799;
</PRE>
<P><LI>This outputs the string "number = 32.567799."
<PRE>
output = Format("number = %f", value1);
Echo(output);
</PRE>
<P><LI>This example outputs the string "number = 32.57."
<PRE>
output = Format("number = %3.2f", value1);
Echo(output);
</PRE>
<P><LI>This example outputs the string "number = 32.57."
<PRE>
output = Format("number = %11.2f", value1);
Echo(output);
</PRE>
<P><LI>In this example, <I>value2</I> is set to 134569888
and <I>value3</I> is set to "New York."
<PRE>
value2 = 134569888;
value3 = "New York";
</PRE>
<P><LI>This example outputs the string
<BR>
"number = 134569888.000000, state = New York."
<PRE>
output = Format("number = %f, state = %s", value2, value3);
Echo(output);
</PRE>
<P><LI>This example outputs the string
"number =  134569888, state = New York."
<PRE>
output = Format("number = %10.0f, state = %s", value2, value3);
Echo(output);
</PRE>
<P><LI>This example outputs the string
"number = 1.3457e+08, state = New York."
<PRE>
output = Format("number = %g, state = %s", value2, value3);
Echo(output);
</PRE>
<P><LI>This example outputs the string
<BR>
"number = 1.3457e+08, state = New York."
<PRE>
output = Format("number = %g, state = %15s", value2, value3);
Echo(output);
</PRE>
</OL>
<P><STRONG>Example Visual Programs</STRONG>
<PRE>
ContoursAndCaption.net
GeneralImport1.net

FormatListMacro.net

InvalidData.net
PlotTwoLines.net

SalesOnStates.net

Sealevel.net
</PRE>
<P><STRONG>See Also</STRONG>
<P>
&nbsp;<A HREF="refgu022.htm#HDRCAPTION">Caption</A>,
&nbsp;<A HREF="refgu051.htm#HDRECHO">Echo</A>,
&nbsp;<A HREF="refgu156.htm#HDRTEXT">Text</A>
		<P>
		<HR>
		<DIV align="center">
			<P><A href="../allguide.htm"><IMG src="../images/foot-fc.gif" width="94" height="18" border="0" alt="Full Contents"></A> <A href="../qikguide.htm"><IMG src="../images/foot-qs.gif" width="94" height="18" border="0" alt="QuickStart Guide"></A> <A href="../usrguide.htm"><IMG src="../images/foot-ug.gif" width="94" height="18" border="0" alt="User's Guide"></A> <A href="../refguide.htm"><IMG src="../images/foot-ur.gif" width="94" height="18" border="0" alt="User's Reference"></A></P>
		</DIV>
		<DIV align="center">
			<P><FONT size="-1">[ <A href="http://www.research.ibm.com/dx">OpenDX Home at IBM</A>&nbsp;|&nbsp;<A href="http://www.opendx.org/">OpenDX.org</A>&nbsp;] </FONT></P>
		</DIV>
		<P></P>
	</BODY></HTML>
